<template>
  <template v-if="column.slots">
    <vxe-column v-bind="localColumn">
      <template #[key]="{ row }" v-for="(value, key) in column.slots" :key="key">
        <Container :record="row">
          <LowCode :schema="value" />
        </Container>
      </template>
    </vxe-column>
  </template>
  <vxe-column v-else-if="column.body" v-bind="localColumn">
    <template #default="{ row }">
      <Container :record="row">
        <Body :body="column.body" />
      </Container>
    </template>
  </vxe-column>
  <vxe-column v-else v-bind="localColumn" />
</template>

<script setup>
import LowCode from '@/components/LowCode.vue'
import { plainFilterAttr } from '../../common/util'
import Container from '../container/index.vue'
import Body from '../body/index.vue'

const props = defineProps({
  column: {
    type: Object,
    required: true
  }
})
const localColumn = plainFilterAttr(props.column, ['body', 'searchable', 'slots'])
</script>
